﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Bll;

namespace StockServer
{
    public partial class UserGroupInfoCustomer : DevExpress.XtraEditors.XtraForm
    {
        ClientUser cr = new ClientUser();
        public UserGroupInfoCustomer()
        {
            InitializeComponent();
        }

        private void UserGroupInfoCustomer_Load(object sender, EventArgs e)
        {
            //得到用户组
            DataSet ds = new DataSet();
            ds = cr.getUserGroupInfo();
            string selectGoupid = string.Empty;
            if (ds != null)
            {
                lstUserg.DataSource = ds.Tables[0].DefaultView;
                lstUserg.DisplayMember = "ac_group";
                lstUserg.ValueMember = "group_id";
                
            }
        }

        private void lstUserg_Click(object sender, EventArgs e)
        {

            if(listView1.Items.Count!=0)
            {
                listView1.Items.Clear();
            
            }
            DataSet ds = cr.getUserInfoByGroup(lstUserg.SelectedValue.ToString());
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            { 
                for(int i=0;i<ds.Tables[0].Rows.Count;i++)
                {
                    listView1.Items.Add(ds.Tables[0].Rows[i][0].ToString()+"\n\r");
                }        
            
            }
        }
    }
}